import request from './request.js'
import configs from './configs'

const baseURL = configs.API_BASE_URL


// 获取租户
export const getTenantId = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/admin-api/system/tenant/get-id-by-name?name=芋道源码`,
		data
	})
}

// 附件打包下载
export const downloadById = (data) => {
  return request({
		baseURL,
		method: 'GET',
		responseType:'arraybuffer',
		url: `/admin-api/zy/attachment/downloadById`,
		data
	})
}

// 获取某数据的详情数据(图表)
export const getDataDetailInfo = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/admin-api/zy/wx/getDetailedData`,
		data
	})
}

// 云睿苗情摄像头操作
export const cameraOperation = (data) => {
  return request({
		baseURL,
		method: 'POST',
		url: `/admin-api/zy/wx/ryCameraOperation`,
		data
	})
}

// 获取抓拍列表
export const getPresetFile = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/admin-api/zy/wx/getPresetFile`,
		data
	})
}

// 获取虫情附件列表
export const getInsectSentimentFile = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/admin-api/zy/wx/getInsectSentimentFile`,
		data
	})
}

// 云睿设置摄像头预置点
export const configPreset = (data) => {
  return request({
		baseURL,
		method: 'POST',
		url: `/admin-api/zy/wx/device/configPreset`,
		data
	})
}

// 云睿查询摄像头预置点
export const queryPreset = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/admin-api/zy/wx/device/queryPreset`,
		data,
		header:{
			"tenant-id":1
		}
	})
}

// 云睿转至摄像头预置点
export const moveToPreset = (data) => {
  return request({
		baseURL,
		method: 'POST',
		url: `/admin-api/zy/wx/device/moveToPreset`,
		data
	})
}
// 云睿摄像头抓拍
export const getChannelSnap = (data) => {
  return request({
		baseURL,
		method: 'POST',
		url: `/admin-api/zy/wx/device/getChannelSnap`,
		data
	})
}

// 获取摄像头信息
export const ryCreateFlvLive = (code) =>{
  return request({
    url: `/admin-api/zy/equipment/ryCreateFlvLive?equipmentCode=${code}`,
    method: 'get'
  })
}

// 获取下拉类型字典
export const getDictType = (type) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/admin-api/system/dict-data/type/` +type
	})
}

// 获取下拉类型字典全部
export const getDictTypeAll = () => {
  return request({
		baseURL,
		method: 'GET',
		url: `/admin-api/system/dict-data/list-all-simple`
	})
}
// 登录
export const Login = (data) => {
  return request({
		baseURL,
		method: 'POST',
		url: `/admin-api/system/auth/login`,
		data
	})
}
// 重置密码
export const resetPassword = (data) => {
  return request({
		baseURL,
		method: 'PUT',
		url: `/admin-api/system/user/update-password`,
		data
	})
}

// 获取设备分页
export const obtainDeviceData = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/admin-api/zy/wx/obtainDeviceData`,
		data
	})
}

// 获取设备详情
export const getequipmentDetail = (id) => {
  return request({
		baseURL,
		method: 'GET',
		url: '/admin-api/zy/wx/equipmentDetail?id='+id,
	})
}
// 根据设备序列号获取设备数据信息
export const getDetailedData = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/admin-api/zy/wx/obtainDeviceData?equipmentCode=` + data,
	})
}
// 获得获取当前登录人设备列表分页
export const equipmentPage = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/admin-api/zy/wx/equipmentPage`,
		data
	})
}

// 获得获取当前登录人虫情-设备 数据查看 虫情分析
export const curveAnalysis = (data) => {
	// ?cameraCode=FZ0791999&startTime=2025-10-04&endTime=2025-10-11&type=
  return request({
		baseURL,
		method: 'GET',
		url: `admin-api/zy/pictureSign/curveAnalysis`,
		data
	})
}

// 获得首页设备数量统计
export const equipmentStatistics = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/admin-api/zy/wx/equipmentStatistics`,
		data
	})
}

// 虫情标注信息
export const getByAttachmentId = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/admin-api/zy/wx/pictureSign/getByAttachmentId`,
		data
	})
}


// 字典
export const listAllSimple = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/admin-api/system/dict-data/list-all-simple`,
		data
	})
}

// 字典
export const dataAnalysis = (data) => {
  return request({
		baseURL,
		method: 'GET',
		url: `/admin-api/zy/pictureSign/dataAnalysis`,
		data
	})
}

// 图片识别
export const recongnizeAnimal = (data) => {
	return request({
		  baseURL,
		  method: 'POST',
		  url: `/admin-api/zy/equipment/recognizeAnimal`,
		  data
	  })
  }